﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;

namespace pngCombo
{
    public enum VerticalAlignEnum{Top=0, Middle=1, Bottom=2};
    public enum HorizontalAlignEnum{Left=0, Center=1, Right=2};
    public struct Source
    {
        public string Path;
        public bool isDirectory;

        public Source(string path, bool isDir)
        {
            this.Path = path;
            this.isDirectory = isDir;
        }
    }

    /// <summary>
    /// Usage:
    /// pngCombo -bg #RGBA -h height -w width -o <output\path> -ha left|center|right -va top|center|bottom -i <filename> [<filename> ...]
    /// ........................................ <-background--|--foreground->
    /// </summary>
    class Combiner
    {
        private Color _bg;
        public Color BackGround{
            get{return _bg;}
            set { if (value != null) { _bg = value; } else { throw new NullReferenceException(); } }
        }

        private Size _sz;
        public Size OutputSize {
            get { return _sz; }
            set { if (value != null) { _sz = value; } else { throw new NullReferenceException(); } }
        }

        private VerticalAlignEnum _va;
        public VerticalAlignEnum VerticalAlign
        {
            get { return _va; }
            set { if (value != null) { _va = value; } else { throw new NullReferenceException(); } }
        }
        
        private HorizontalAlignEnum _ha;
        public HorizontalAlignEnum HorizontalAlign
        {
            get { return _ha; }
            set { if (value != null) { _ha = value; } else { throw new NullReferenceException(); } }
        }

        private int _count;
        public int Count { get { return _count; } }

        private string _outPath;
        public string Output
        {
            get { return _outPath; }
            set
            {
                if (value != null && Directory.Exists(value))
                {
                    _outPath = value;
                } else {
                    throw new NullReferenceException();
                }
            }
        }
        // TODO: name new files using nameMask
        private string _nameMask;
        private List<Source> _sorceList;
        

        public Combiner()
        {

        }

        public void AddSource(string path)
        {
            if (path != null)
            {
                if (Directory.Exists(path))
                    _sorceList.Add(new Source(path, true));
                else if (File.Exists(path))
                    _sorceList.Add(new Source(path, false));
                else
                    throw new FileNotFoundException("Source not exist", path);
            }
            else
            {
                throw new NullReferenceException("Source can't be null!");
            }
        }

        public bool MakeAll() { return false; }

    }
}
